﻿<DemoContainer>
    <ApexChart TItem="Order"
               Title="Order Gross Value" Options=options>

        <ApexPointSeries TItem="Order"
                         Items="Orders"
                         Name="Gross Value"
                         SeriesType="SeriesType.Pie"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.GrossValue))"
                         OrderByDescending="e=>e.Y"
                         ShowDataLabels />
    </ApexChart>
</DemoContainer>

@code {
    private List<Order> Orders { get; set; } = SampleData.GetOrders();
    private ApexChartOptions<Order> options { get; set; } = new();

    protected override void OnInitialized()
    {
        options.DataLabels = new DataLabels
            {
                Formatter = @"function(value, { seriesIndex, w }) {
            return w.config.series[seriesIndex];}"
            };

    }
   }